package com.foreveross.proxyip.core.redis;

import java.util.List;

import com.foreveross.proxyip.core.BaseCode;
import com.foreveross.proxyip.entity.ProxyIpBean;
import com.sun.istack.NotNull;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.Transaction;


public abstract class Map {
//	JedisPool pool = null;
	
//	public Long storeTimeOut = Long.parseLong(BaseCode.getValue("RDS_TIMEOUT"));
	
//	 byte[] storeName = "IpStoreMap".getBytes();
	 String keyName = "keyName";
	 public Map(String keyName2){
		 this.keyName = keyName2;
//		 this.pool = RedisManager.getInstance().getJedisPool();
	 }
	 
//	 public Jedis getRedis(){
//		return pool.getResource();
//	 }
	public abstract Long size() throws PiRedisExecption ;
//	public abstract Long size(Jedis jedis) throws PiRedisExecption;
	public abstract boolean isEmpty() throws PiRedisExecption ;
	public abstract boolean containsKey(String key)throws PiRedisExecption ;
//	public abstract Long update(String key, AbstractStoreBean value) throws Exception ;
	public abstract Long set(String key)throws PiRedisExecption;
	public abstract Long remove(String key)throws PiRedisExecption;
	public abstract Long clear()throws PiRedisExecption ;
	public abstract List<ProxyIpBean> subList(Long start,Long end)throws PiRedisExecption;

	public abstract void clear(@NotNull Transaction tran) ;

//	public abstract List<ProxyIpBean> subList(@NotNull Transaction tran, Long start, Long end)
//			throws Exception ;
	
	public abstract void remove(@NotNull Transaction tran,String key) throws Exception ;
	
//	public abstract void set(Jedis redis ,@NotNull Transaction tran,String key) throws Exception ;

//	public abstract boolean containsKey(Jedis jedis, String ip) ;

	public abstract void set(Transaction tran, String key) throws Exception ;
	
	public abstract void set(Transaction tran, int score, String key) throws Exception ;
	
	public abstract String getKey(Long i) throws PiRedisExecption;
	
	public abstract List<String> getKeys(Long start,Long end) throws PiRedisExecption;

	
	
//	public abstract boolean containsKey(@NotNull Transaction tran,String key);
	
//	public abstract boolean isEmpty(@NotNull Transaction tran);
//	
//	public abstract Long size(@NotNull Transaction tran);

}
